/*
 * Scenery.h
 *
 *  Created on: 30/01/2011
 *      Author: Nenem
 */

#ifndef SCENERY_H_
#define SCENERY_H_

#include "BGMatrix.h"
#include "Tools.h"

//#include "ObjectManager.h"
#include "RigidBody.h"
#include "Direction.h"
#include "Position.h"

#include "SDL/SDL.h"
#include "SDL/SDL_image.h"

#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
using namespace std;

class ObjectManager;

class Scenery {
	BGMatrix *matrix;
	int widthSquare;
	int heightSquare;
	int x;
	int y;
	int w;
	int h;
	string newMap;
	bool changeMap;
	vector<int> objIDs;
public:
	SDL_Surface *layerA;
	SDL_Surface *layerB;
	Scenery();
	Scenery(string bgName);
	virtual ~Scenery();
	Point2D worldCollision(Body *body, Point2D oldP, Point2D newP, Direction *direction);
	void moveMap(Position *position, int resolutionX, int resolutionY);
	void LoadNewMap(string newMap);
	void loadAtributes(string bgName);
	void LoadMap(string bgName);
	vector<string> breakString(string str, char ch);
	void update(int delta, ObjectManager *objManager);
	EnumTerrainType getTerrain(Position *position);

    int getH() const
    {
        return h;
    }

    int getW() const
    {
        return w;
    }

    int getWidthSquare() const
    {
        return widthSquare;
    }

    void setH(int h)
    {
        this->h = h;
    }

    void setW(int w)
    {
        this->w = w;
    }

    void setWidthSquare(int widthSquare)
    {
        this->widthSquare = widthSquare;
    }

    SDL_Surface *getLayerA() const
	{
		return layerA;
	}

	SDL_Surface *getLayerB() const
	{
		return layerB;
	}

	int getX() const
	{
		return x;
	}

	int getY() const
	{
		return y;
	}

	void setLayerA(SDL_Surface *layerA)
	{
		this->layerA = layerA;
	}

	void setLayerB(SDL_Surface *layerB)
	{
		this->layerB = layerB;
	}

	void setY(int y)
	{
		this->y = y;
	}

};

#endif /* SCENERY_H_ */
